<template>
	<view class="contact">
		<!-- 电话 -->
		<view @click="playPhone()" class="phone">
			<view>
				联系电话
				<view>
					{{MyPhone}}
				</view>
			</view>

			<view>
				<van-icon size="30px" name="phone-o" />
			</view>
		</view>
		<!-- 地址 -->
		<view class="address">
			{{MyAddress}}
		</view>
	</view>
</template>

<script>
	export default {
		name: "Contact",
		data() {
			return {
				MyAddress: "江西省",
				MyPhone: "19136971947"
			};
		},
		methods: {
			playPhone() {
				uni.makePhoneCall({
					// 手机号 这里可以直接写号码如 12345 也可以写获取号码的字段如this.mobile
					phoneNumber: this.MyPhone,
					// 成功回调
					success: (res) => {
						console.log('调用成功!')
					},
					// 失败回调
					fail: (res) => {
						console.log('调用失败!')
					}
				});
			}
		},
	}
</script>

<style scoped lang="scss">
	.contact {
		display: flex;

		.phone {
			display: flex;
			justify-content: space-between;
			font-weight: 400;
		}

		.phone,
		.address {
			width: 50%;
			margin: 20rpx 10rpx;
			padding: 10rpx;
			border-radius: 5px;
			// aspect-ratio: 5/1;
			background-color: #F9F9F9;
			box-sizing: border-box;

		}
	}
</style>
